package net.caixiaomi.info.adapter;

import android.support.annotation.LayoutRes;
import android.support.v4.content.ContextCompat;

import net.caixiaomi.info.R;
import net.caixiaomi.info.app.CommonApp;
import net.caixiaomi.info.base.quickadapter.BaseQuickAdapter;
import net.caixiaomi.info.base.quickadapter.BaseViewHolder;
import net.caixiaomi.info.model.CustomerModel;

/**
 * Created by mengxianzheng on 2018/4/18.
 */

public class DateAdapter extends BaseQuickAdapter<CustomerModel, BaseViewHolder> {
    public DateAdapter(@LayoutRes int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, CustomerModel item) {
        try {
            helper.setText(R.id.text, item.getName());
            helper.setTextColor(R.id.text, ContextCompat.getColor(CommonApp.getInstance(), item.isSelected() ? R.color.orange_primary : R.color.primary_text));
            helper.setGone(R.id.line, helper.getAdapterPosition() != getData().size() - 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
